<%@ page contentType="text/html;charset=utf-8" language="java" import="java.sql.*,java.util.*" errorPage="" %>
<script src="jquery-latest.js"></script>

<HTML>
<HEAD>
<TITLE>UseCase System</TITLE>
<script language="javascript">
<!--

//-->
</script>
</HEAD>
<jsp:useBean id="DBCon" class="test.DBCon"/>
<%
    Connection conn = null;
	conn = DBCon.getInstance().getConnection();
    Statement stmt = null;

    String casename = "";
    String actor = "";
	String desc = "";
    String precond = "";
    String trig = "";	
    String aa = "";	
    String sr = "";	
    String ac = "";
    String conclu = "";
    String postcond = "";
    String brs = "";
    String app = "";	
    try {
      stmt = conn.createStatement();
	  String sql1 = "SELECT * FROM usecase WHERE account_number = '" + session.getAttribute("userid") + "' and Use_case_ID ='" + session.getAttribute("usecaseid") + "' and Case_Type  ='" + session.getAttribute("usecasetype") + "'";
      ResultSet rs = stmt.executeQuery(sql1);    
	     
	   if (rs.next()){
	      // caseid = rs.getString("Use_case_ID"); 
	       //casetype = rs.getString("Case_Type"); 	
	       casename = rs.getString("Use_case_Name"); 
	       actor = rs.getString("Actor"); 
	       desc = rs.getString("Description"); 
	       precond = rs.getString("Precondition"); 
	       trig = rs.getString("Trig"); 
	       aa = rs.getString("Actor_Action"); 
	       sr = rs.getString("System_Response"); 
	       ac = rs.getString("Alternate_Courses"); 
	       conclu = rs.getString("Conclusion"); 
	       postcond = rs.getString("Postcond"); 
		   brs = rs.getString("Business_Rules"); 
		   app = rs.getString("Appendix"); 
        }
        rs.close();
    }
    catch(SQLException e) {

    }
    finally {
        try {
            stmt.close();
            conn.close();
        }
        catch(SQLException e) {

        }
    }
%>

<BODY>
<script>   
  function change(){
    var casename = document.getElementById('casename');
	var actor = document.getElementById('actor');
	var desc = document.getElementById('desc');
	var precond = document.getElementById('precond');
	var trig = document.getElementById('trig');
	var aa = document.getElementById('aa');
	var sr = document.getElementById('sr');
	var ac = document.getElementById('ac');
	var conclu = document.getElementById('conclu');
	var postcond = document.getElementById('postcond');
	var brs = document.getElementById('brs');
	var app = document.getElementById('app');
	var but = document.getElementById('button1');
    var sbm = document.getElementById('submit1');
	
	
	but.disabled = true;	
	sbm.disabled = false;
	
	casename.readOnly = false; 
	actor.readOnly = false;
	desc.readOnly = false; 
	precond.readOnly = false;
	trig.readOnly = false;
	aa.readOnly = false;
	sr.readOnly = false;
	ac.readOnly = false;
	conclu.readOnly = false;
	postcond.readOnly = false;
	brs.readOnly = false;
	app.readOnly = false;
	//but.value = "modify finish"
  }   
 </script>   
<form name="testForm" action="update.jsp"> 
<table width="605" border="1">
  <tr>
    <td width="136" bordercolor="#000000">Use_case_ID </td>
    <td width="207" bordercolor="#000000"><input type="text" name="caseid" value="<%=session.getAttribute("usecaseid")%>" readonly/></td>
    <td width="66" rowspan="2" bordercolor="#000000">Case_Type</td>
    <td width="168" rowspan="2" bordercolor="#000000"><input type="text" name="casetype" value="<%=session.getAttribute("usecasetype")%>" readonly/></td>
  </tr>
  <tr>
    <td bordercolor="#000000">Use_case_Name</td>
    <td bordercolor="#000000"><input type="text" name="casename" value="<%=casename%>" readonly/></td>
  </tr>
  <tr>
    <td bordercolor="#000000">Actor</td>
    <td colspan="3" bordercolor="#000000"><input type="text" name="actor" value="<%=actor%>" readonly/></td>
  </tr>
  <tr>
    <td bordercolor="#000000">Description</td>
    <td colspan="3" bordercolor="#000000"><input type="text" name="desc" value="<%=desc%>" readonly/></td>
  </tr>
  <tr>
    <td bordercolor="#000000">Precondition</td>
    <td colspan="3" bordercolor="#000000"><input type="text" name="precond" value="<%=precond%>" readonly/></td>
  </tr>
  <tr>
    <td bordercolor="#000000">Trigger</td>
    <td colspan="3" bordercolor="#000000"><input type="text" name="trig" value="<%=trig%>" readonly/></td>
  </tr>
  <tr>
    <td rowspan="2" bordercolor="#000000">Typical  Course of Events</td>
    <td bordercolor="#000000">Actor_Action</td>
    <td colspan="2" bordercolor="#000000">System_Response</td>
  </tr>
  <tr>
    <td bordercolor="#000000"><input type="text" name="aa" value="<%=aa%>" readonly/></td>
    <td colspan="2" bordercolor="#000000"><input type="text" name="sr" value="<%=sr%>" readonly/></td>
  </tr>
  <tr>
    <td bordercolor="#000000">Alternate_Courses</td>
    <td colspan="3" bordercolor="#000000"><input type="text" name="ac" value="<%=ac%>" readonly/></td>
  </tr>
  <tr>
    <td bordercolor="#000000">Conclusion</td>
    <td colspan="3" bordercolor="#000000"><input type="text" name="conclu" value="<%=conclu%>" readonly/></td>
  </tr>
  <tr>
    <td bordercolor="#000000">Postcondition</td>
    <td colspan="3" bordercolor="#000000"><input type="text" name="postcond" value="<%=postcond%>" readonly/></td>
  </tr>
  <tr>
    <td bordercolor="#000000">Business_Rules</td>
    <td colspan="3" bordercolor="#000000"><input type="text" name="brs" value="<%=brs%>" readonly/></td>
  </tr>
  <tr>
    <td bordercolor="#000000">Appendix</td>
    <td colspan="3" bordercolor="#000000"><input type="text" name="app" value="<%=app%>" readonly/></td>
  </tr>
</table>  

  <strong>modify :</strong>   
  <input type="button" value=" modify " name=button1 onClick="change()">
  <input type="submit" value=" submit " name=submit1 disabled="disabled"/>
  <strong>delete :</strong> 
  <input name="Submit" type="button" id="submit2" onClick="self.location.href='del.jsp'" value=" delete " />
<p><input name="Submit" type="button" id="Submit" onClick="self.location.href='query.jsp'" value="return query" /></p>

</form>
</body>
</html>
